/*
 * openmv.h
 *
 *  Created on: May 26, 2021
 *      Author: kirk_
 */

#ifndef OPENMV_H_
#define OPENMV_H_

#include "config.h"

#define OpenMV_Task_Line  (1U)
#define OpenMV_Task_Color (2U)
#define OpenMV_Task_Block (3U)

extern volatile uint8_t  control_s;  /* 0 turn, 1 go staight */
extern volatile uint8_t  control_t;  /* 0 turn left, 1 turn right */
extern volatile uint8_t  control_c;  /* 0 not found, 1 45 degree turn, 2 90 degree, 3 135 degree */
extern volatile uint16_t control_x;  /* horizontal position, 128 is center */
extern volatile uint16_t control_y;  /* vertical position, 128 is center */
extern volatile uint16_t control_r;  /* Radius */
extern volatile uint8_t  control_n;  /* new or old, when received convert to 1, when used convert to 0 */

void OpenMV1(uint8_t s, uint8_t t);
void OpenMV2(uint8_t c);
void OpenMVCtl(uint8_t command);

void OpenMV3(uint16_t x, uint16_t y, uint16_t r);
void OpenMVLog(void);

void OpenMVFront(void);
void OpenMVDown(void);

void OpenMVReset(void);
void OpenMVSet(void);

#endif /* OPENMV_H_ */
